#include "gamesound.h"
#include "gameutil.h"
GameSound::GameSound()
{
    bg = new CSound("BGMusic.ogg",true,1);
    select = new CSound("Select.ogg",false,1);
    towerUpgrade = new CSound("TowerUpdata.ogg",false,1);
    selectFault = new CSound("SelectFault.ogg",false,1);
    lockAttack = new CSound("ShootSelect.ogg",false,1);
    towerBuild = new CSound("TowerBulid.ogg",false,1);
    lose = new CSound("Lose.ogg",false,1);
    gameCount = new CSound("GameStart.ogg",false,1);
    success = new CSound("Success.ogg",false,1);
    GameBgMusic = new CSound("musicBG.ogg",true,1);
}
void GameSound::PlaySuccess(){success->PlaySoundA();}
void GameSound::PlayGameMusic(){GameBgMusic->PlaySoundA();}
void GameSound::PlayCount()
{
    gameCount->PlaySoundA();
}
void GameSound::PlayBuild()
{
    towerBuild->PlaySoundA();
}
void GameSound::PlayBG()
{
    bg->PlaySoundA();
}
void GameSound::PlayLose()
{
    lose->PlaySoundA();
}
void GameSound::PlaySelect()
{
    select->PlaySoundA();
}
void GameSound::PlayFault()
{
    selectFault->PlaySoundA();
}
void GameSound::PlayUpgrade()
{
    towerUpgrade->PlaySoundA();
}
void GameSound::PlayLock()
{
    lockAttack->PlaySoundA();
}
void GameSound::PlayFire(int type)
{
    CSound *sound=NULL;
    switch (type){
    case 0:
        sound = new CSound("bullet_0.ogg",false,1);
        break;
    case 1:
        sound = new CSound("bullet_1.ogg",false,1);
        break;
    default:
        break;
    }
    sound->PlaySoundA();
}
void GameSound::PlayOver(int type)
{
    CSound *sound=NULL;
    char *nameHead = CSystem::MakeSpriteName("over",type);
    char *name = GameUtil::connect_string(nameHead,".ogg");
    sound = new CSound(name,false,1);
    sound->PlaySoundA();
}
GameSound::~GameSound()
{

}
